package com.gitee.tje.waving.aop;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

/**
 * @author taojiaen
 * @date 2018-02-19 22:14
 */
public abstract  class BaseAnnotationPointCut implements PointCut{

    @Override
    public boolean isAllValid(Object object) {
        if (object == null) {
            return false;
        }

        return object.getClass().getAnnotation(getAnnotation()) != null;
    }

    @Override
    public boolean isMethodValid(Method method) {
        return method.getAnnotation(getAnnotation()) != null;
    }
    abstract Class<? extends Annotation> getAnnotation();
}
